<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 定义全局组件
    const CommonHead = {
      template: `
        <div>
          <h2>我是公共的头部</h2>  
          {{ msg }}
          <logo></logo>
          {{ child }}
        </div>
      `,
      data() {
        return {
          msg: '父组件内部数据',
          a: '父组件数据111'
        }
      },
      components: {
        Logo: {
          template: `
            <div>
              <h3>我是子组件</h3>  
              {{ msg }}
              {{ a }}
            </div>
          `,
          data() {
            return {
              msg: '子组件内部数据',
              child: '子组件中的数据'
            }
          }
        }
      }
    }
    Vue.component('CommonHead', CommonHead)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>

</html>